import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/page/index/index'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/index',
      component: Layout,
      children: [{
        path: '',
        name: '主页',
        component: () =>
          import( /* webpackChunkName: "views" */ '@/views/home/index')
      }]
    },
    {
      path: '/',
      name: '主页',
      redirect: '/index'
    },
    {
      path: '/productDetail/:id',
      component: Layout,
      children: [{
        path: '',
        name: '商品详情',
        component: () =>
          import( /* webpackChunkName: "views" */ '@/views/product_detail/index')
      }]
    },
    {
      path: '/login',
      name: '登录注册',
      component: () =>
        import( /* webpackChunkName: "views" */ '@/views/login/index')
    },
    {
      path: '/cart',
      name: '购物车',
      component: () =>
        import( /* webpackChunkName: "views" */ '@/views/cart/index')
    },
    {
      path: '/list/:categopryid',
      name: '列表',
      component: () =>
        import( '@/views/list/index')
    },
    {
      path: '/pay/',
      name: '结算中心',
      component: () =>
        import( /* webpackChunkName: "views" */ '@/views/pay/index')
    },
    {
      path: '/info/',
      name: '个人中心',
      component: () =>
        import( /*  */ '@/views/info/index')
    },
    {
      path: '/payment/',
      name: '支付',
      component: () =>
        import( /*  */ '@/views/payment/index')
    }

  ]
})
